require ‘net/smtp’
require ‘rmail’

#resender = ‘guilhem.bonnefille@free.fr’
#recipient = ‘guilhem.bonnefille@gmail.com’

# Suppress initial “From” line
$stdin.gets

# Read the message
message = RMail::Parser.read($stdin)

message.header.add(’Resent-To’, recipient, 0)
message.header.add(’Resent-From’, resender, 0)
time = Time.now
message.header.add(’Resent-Date’, time.to_s, 0)

Net::SMTP.start(’localhost’, 25) do |smtp|
smtp.send_message message.to_s,
resender,
recipient
end
